class Storage {
    static getInstance(){
        if(!Storage.instance){
            Storage.instance = new Storage()
        }
        return Storage.instance
    }
    getItem(key){
        return localStorage.getItem(key)
    }
    setItem(key,value){
        return localStorage.setItem(key,value)
    }
}

const storage1 = Storage.getInstance()
const storage2 = Storage.getInstance()

storage1.setItem('name','计涛')
storage1.getItem('name') // 计涛
storage2.getItem('name') // 计涛

storage1 === storage2 // true